﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace VK.Casemeet.Articles
{
    public class SearchUrlEntity
    {
        public string ContainAllKeyword { set; get; }
        public string ContainAnyKeyword { set; get; }
        public string BegDate { set; get; }
        public string EndDate { set; get; }
        public string Location { set; get; }
        public int Category { set; get; }
        public int PageIndex = 0;
        public int PageSize = 10;

        public string ToUrlString()
        {
            StringBuilder urlhtml = new StringBuilder();

            urlhtml.Append("/Search")
                .Append("?All=").Append(HttpUtility.UrlEncode(ContainAllKeyword))
                .Append("&Any=").Append(HttpUtility.UrlEncode(ContainAnyKeyword))
                .Append("&Beg=").Append(HttpUtility.UrlEncode(BegDate))
                .Append("&End=").Append(HttpUtility.UrlEncode(EndDate))
                .Append("&Loc=").Append(HttpUtility.UrlEncode(Location))
                .Append("&Cat=").Append(Category)
                .Append("&Index=").Append(PageIndex)
                .Append("&Size=").Append(PageSize);

            return urlhtml.ToString();
        }

        /// <summary>
        /// 复制对象
        /// </summary>
        /// <returns>返回它本身的一个副本</returns>
        public object GetCopy()
        {
            return MemberwiseClone();
        }
    }
}
